#!/bin/bash
count=1
# file="test.txt"
file="/tmp/test.txt"
while true
do
    echo "count: ${count}" >> ${file}
    count=$((count+1))
    sleep 1
done